package day02;

import java.util.ArrayList;
import java.util.LinkedList;

/*
 *文件名: LinkListDemo
 *创建者:
 *创建时间:2025/5/20 09:56
 *描述:
 */
public class LinkListDemo {
    public static void main(String[] args) {

        LinkedList<String> list = new LinkedList<>();

        list.addFirst("a");
        list.addLast("b");
        list.addLast("c");
        list.addLast("d");
        list.addLast("e");

        String s = list.get(3);//o(n) 时间复杂度
        ArrayList<String> list1 = new ArrayList<>();//

        String first = list.getFirst();
        System.out.println(first);
        String last = list.getLast();
        System.out.println(last);

        String removeFirst = list.removeFirst();
        System.out.println(removeFirst);
        String removeList = list.removeLast();
        System.out.println(removeList);

        System.out.println(list);

    }
}
